package com.zzy.controller;

import com.zzy.adpter.Login3rdAdapter;
import com.zzy.adpter.Login3rdTarget;
import com.zzy.pojo.UserInfo;
import com.zzy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class GiteeContorller {

    @Autowired
    private Login3rdAdapter login3rdAdapter;

    /**
     * https://gitee.com/oauth/authorize?client_id=8a852b580100838873e1e93776aba77da26f60893fd66da705f19377c11c3207&redirect_uri=http://localhost:8081/auth&response_type=code&state=GITEE
     * @param code
     * @param state
     * @return
     */
    @GetMapping("/auth")
    public String auth(String code, String state) {
        return login3rdAdapter.loginByGitee(code, state);
    }
}
